var app        = getApp()
module.exports = {
    currentPage: null,
    currentPageOptions: {},
    navbarPages: [ "pages/index/index", "pages/cat/cat", "pages/cart/cart", "pages/user/user", "pages/list/list", "pages/search/search", "pages/topic-list/topic-list", "pages/video/video-list", "pages/miaosha/miaosha", "pages/shop/shop", "pages/pt/index/index", "pages/book/index/index", "pages/share/index", "pages/quick-purchase/index/index", "mch/m/myshop/myshop", "mch/shop-list/shop-list", "pages/integral-mall/index/index", "pages/integral-mall/register/index", "pages/article-detail/article-detail", "pages/article-list/article-list", "pages/order/order" ],
    onLoad: function(t, e) {
        t.setData(e) // 把options设置到data里
        t.setData({userInfo: wx.getStorageSync('__user_info')})
        
        // 一些原始方法封装(protype) 日期Format
        this.prototypePackage()

        this.currentPage = t, this.currentPageOptions = e;
        var o = this;
        t.navigatorClick = function(e) {
            o.navigatorClick(e, t);
        }, void 0 === t.showToast && (t.showToast = function(e) {
            o.showToast(e);
        }), getApp().shareSendCoupon = function(e) {
            o.shareSendCoupon(e);
        }, void 0 === t.setTimeList && (t.setTimeList = function(e) {
            return o.setTimeList(e);
        }), void 0 === t.showLoading && (t.showLoading = function(e) {
        }), void 0 === t.modalConfirm && (t.modalConfirm = function(e) {
            o.modalConfirm(e);
        }), void 0 === t.modalClose && (t.modalClose = function(e) {
            o.modalClose(e);
        }), void 0 === t.modalShow && (t.modalShow = function(e) {
            o.modalShow(e);
        }), void 0 === t.myLogin && (t.myLogin = function() {
            o.myLogin();
        }), void 0 === t.getUserInfo && (t.getUserInfo = function(e) {
            o.getUserInfo(e);
        }), void 0 === t.wechatSignIn && (t.wechatSignIn = function(e) {
            o.wechatSignIn(e)
        }), void 0 === t.showAuth && (t.showAuth = function(e) {
            o.showAuth(e)
        }),void 0 === t.hideAuth && (t.hideAuth = function(e) {
            o.hideAuth(e)
        });
        //     o.getPhoneNumber(e);
        // }), void 0 === t.bindParent && (t.bindParent = function(e) {
        //     o.bindParent(e);
        // }), void 0 === t.closeCouponBox && (t.closeCouponBox = function(e) {
        //     o.closeCouponBox(e);
        // }), void 0 === t.relevanceSuccess && (t.relevanceSuccess = function(e) {
        //     o.relevanceSuccess(e);
        // }), void 0 === t.relevanceError && (t.relevanceError = function(e) {
        //     o.relevanceError(e);
        // }), void 0 === t.saveQrcode && (t.saveQrcode = function(e) {
        //     o.saveQrcode(e);
        // });
      if (this.setUserInfo(t), this.setWxappImg(t), this.setDeviceInfo(t), this.resetNav(t)) {
          
        }
    },

    /*onLoad里面执行的方法 start*/
    checkLogin(t) {
      var openid    = getApp().WxService.getStorageSync('openid')
      if (!openid) {
        t.setData({
          user_info_show: !0
        })
      }
      
      return true
    },
    setUserInfo(t) {
        // var e = this.currentPage, t = getApp().  ();
        // t && e.setData({
        //     __user_info: t
        // });
        return true
    },
    setWxappImg(t) {
        // var t = this.currentPage;
        // getApp().getConfig(function(e) {
        //     t.setData({
        //         __wxapp_img: e.wxapp_img,
        //         store: e.store
        //     });
        // });
        return true
    },
    setDeviceInfo (e) {
      var e = e, t = [{
        id: "device_iphone_5",
        model: "iPhone 5"
      }, {
        id: "device_iphone_x",
        model: "iPhone X"
      }], o = wx.getSystemInfoSync();
      if (o.model) for (var n in 0 <= o.model.indexOf("iPhone X") && (o.model = "iPhone X"),
        t) t[n].model == o.model && e.setData({
          __device: t[n].id
        });
        return true
    },
    /*onLoad里面执行的方法 end*/

    onReady: function(e, a) {
        this.currentPage = e;
    },
    onShow: function(e) {
        var t = getApp();
        
    },
    onHide: function(e) {
        this.currentPage = e;
    },
    onUnload: function(e) {
        this.currentPage = e;
    },
    onPullDownRefresh: function(e) {
        this.currentPage = e;
    },
    onReachBottom: function(e) {
        this.currentPage = e;
    },
    onShareAppMessage: function(e) {
        this.currentPage = e, setTimeout(function() {
            getApp().shareSendCoupon(e);
        }, 1e3);
    },
    imageClick: function(e) {
        console.log("image click", e);
    },
    textClick: function(e) {
        console.log("text click", e);
    },
    tap1: function(e) {
        console.log("tap1", e);
    },
    tap2: function(e) {
        console.log("tap2", e);
    },
    formSubmit_collect: function(e) {
        e.detail.formId;
        console.log("formSubmit_collect--\x3e", e);
    },
    setStore: function(e) {
        var t = this.currentPage;
        getApp().getConfig(function(e) {
            e.store && t.setData({
                store: e.store,
                __is_comment: e.store ? e.store.is_comment : 1,
                __is_sales: e.store ? e.store.is_sales : 1,
                __is_member_price: e.store ? e.store.is_member_price : 1,
                __is_share_price: e.store ? e.store.is_share_price : 1,
                __alipay_mp_config: e.alipay_mp_config
            });
        });
    },
    setParentId: function(e) {
        var t = this.currentPage;
        if ("/pages/index/index" == t.route && this.setOfficalAccount(), e) {
            var o = 0;
            if (e.user_id) o = e.user_id; else if (e.scene) {
                if (isNaN(e.scene)) {
                    var n = decodeURIComponent(e.scene);
                    n && (n = getApp().helper.scene_decode(n)) && n.uid && (o = n.uid);
                } else -1 == t.route.indexOf("clerk") && (o = e.scene);
                this.setOfficalAccount();
            } else if (null !== getApp().query) {
                var a = getApp().query;
                o = a.uid;
            }
            o && void 0 !== o && (getApp().core.setStorageSync(getApp().const.PARENT_ID, o), 
            getApp().trigger.remove(getApp().trigger.events.login, "TRY_TO_BIND_PARENT"), getApp().trigger.add(getApp().trigger.events.login, "TRY_TO_BIND_PARENT", function() {
                t.bindParent({
                    parent_id: o,
                    condition: 0
                });
            }));
        }
    },
    showToast: function(e) {
        var t = this.currentPage, o = e.duration || 2500, n = e.title || "", a = (e.success, 
        e.fail, e.complete || null);
        t._toast_timer && clearTimeout(t._toast_timer), t.setData({
            _toast: {
                title: n
            }
        }), t._toast_timer = setTimeout(function() {
            var e = t.data._toast;
            e.hide = !0, t.setData({
                _toast: e
            }), "function" == typeof a && a();
        }, o);
    },
    setDeviceInfo: function() {
        var e = this.currentPage, t = [ {
            id: "device_iphone_5",
            model: "iPhone 5"
        }, {
            id: "device_iphone_x",
            model: "iPhone X"
        } ], o = wx.getSystemInfoSync();
        if (o.model) for (var n in 0 <= o.model.indexOf("iPhone X") && (o.model = "iPhone X"), 
        t) t[n].model == o.model && e.setData({
            __device: t[n].id
        });
    },
    setPageNavbar: function() {
        var r = this, s = this.currentPage, e = getApp().core.getStorageSync("_navbar");
        e && n(e);
        var t = !1;
        for (var o in r.navbarPages) if (s.route == r.navbarPages[o]) {
            t = !0;
            break;
        }
        function n(e) {
            var t = !1;
            for (var o in e.navs) {
                var n = e.navs[o].url, a = s.route || s.__route__ || null;
                for (var i in n = e.navs[o].new_url, s.options) getApp().helper.inArray(i, [ "scene", "user_id", "uid" ]) || "page_id" == i && -1 == s.options[i] || (-1 == a.indexOf("?") ? a += "?" : a += "&", 
                a += i + "=" + s.options[i]);
                console.log(a), console.log(n), n === "/" + a ? t = e.navs[o].active = !0 : e.navs[o].active = !1;
            }
            t && (s.setData({
                _navbar: e
            }), r.setPageClasses());
        }
        t && getApp().request({
            url: getApp().api.default.navbar,
            success: function(e) {
                0 == e.code && (n(e.data), getApp().core.setStorageSync("_navbar", e.data));
            }
        });
    },
    setPageClasses: function() {
        var e = this.currentPage, t = e.data.__device;
        e.data._navbar && e.data._navbar.navs && 0 < e.data._navbar.navs.length && (t += " show_navbar"), 
        t && e.setData({
            __page_classes: t
        });
    },
    showLoading: function(e) {
        var t = t;
        t.setData({
            _loading: !0
        });
    },
    hideLoading: function(e) {
        this.currentPage.setData({
            _loading: !1
        });
    },
    setTimeList: function(e) {
        function t(e) {
            return e <= 0 && (e = 0), e < 10 ? "0" + e : e;
        }
        var o = "00", n = "00", a = "00", i = 0, r = "", s = "", c = "";
        if (86400 <= e && (i = parseInt(e / 86400), e %= 86400, r += i + "天", s += i + "天", 
        c += i + "天"), e < 86400) {
            var p = parseInt(e / 3600);
            e %= 3600, r += (a = t(p)) + "小时", s += a + ":", c = 0 < i || 0 < p ? c + a + ":" : "";
        }
        return e < 3600 && (n = t(parseInt(e / 60)), e %= 60, r += n + "分", s += n + ":", 
        c += n + ":"), e < 60 && (r += (o = t(e)) + "秒", s += o, c += o), {
            d: i,
            h: a,
            m: n,
            s: o,
            content: r,
            content_1: s,
            content_ms: c
        };
    },
    setBarTitle: function(e) {
        var t = this.currentPage.route, o = getApp().core.getStorageSync(getApp().const.WX_BAR_TITLE);
        for (var n in o) o[n].url === t && getApp().core.setNavigationBarTitle({
            title: o[n].title
        });
    },
    getNavigationBarColor: function() {
        var t = getApp(), o = this;
        t.request({
            url: t.api.default.navigation_bar_color,
            success: function(e) {
                0 == e.code && (t.core.setStorageSync(getApp().const.NAVIGATION_BAR_COLOR, e.data), 
                o.setNavigationBarColor(), t.navigateBarColorCall && "function" == typeof t.navigateBarColorCall && t.navigateBarColorCall(e));
            }
        });
    },
    setNavigationBarColor: function() {
        var t = this.currentPage, e = getApp().core.getStorageSync(getApp().const.NAVIGATION_BAR_COLOR);
        e && (getApp().core.setNavigationBarColor(e), t.setData({
            _navigation_bar_color: e
        })), getApp().navigateBarColorCall = function(e) {
            getApp().core.setNavigationBarColor(e.data), t.setData({
                _navigation_bar_color: e.data
            });
        };
    },
    navigatorClick: function(e, t) {
        var o = e.currentTarget.dataset.open_type;
        if ("redirect" == o) return !0;
        if ("wxapp" != o) {
            if ("tel" == o) {
                var n = e.currentTarget.dataset.tel;
                getApp().core.makePhoneCall({
                    phoneNumber: n
                });
            }
            return !1;
        }
    },
    shareSendCoupon: function(o) {
        var n = getApp();
        n.core.showLoading({
            mask: !0
        }), o.hideGetCoupon || (o.hideGetCoupon = function(e) {
            var t = e.currentTarget.dataset.url || !1;
            o.setData({
                get_coupon_list: null
            }), t && n.core.navigateTo({
                url: t
            });
        }), n.request({
            url: n.api.coupon.share_send,
            success: function(e) {
                0 == e.code && o.setData({
                    get_coupon_list: e.data.list
                });
            },
            complete: function() {
                n.core.hideLoading();
            }
        });
    },
    bindParent: function(e) {
        var t = getApp();
        if ("undefined" != e.parent_id && 0 != e.parent_id) {
            var o = t.getUser();
            if (0 < t.core.getStorageSync(t.const.SHARE_SETTING).level) 0 != e.parent_id && t.request({
                url: t.api.share.bind_parent,
                data: {
                    parent_id: e.parent_id,
                    condition: e.condition
                },
                success: function(e) {
                    0 == e.code && (o.parent = e.data, t.setUser(o));
                }
            });
        }
    },
    _setFormIdSubmit: function(e) {
        var g = this.currentPage;
        g._formIdSubmit || (g._formIdSubmit = function(e) {
            var t = e.currentTarget.dataset, o = e.detail.formId, n = t.bind || null, a = t.type || null, i = t.url || null, r = t.appId || null, s = getApp().core.getStorageSync(getApp().const.FORM_ID_LIST);
            s && s.length || (s = []);
            var c = [];
            for (var p in s) c.push(s[p].form_id);
            switch (console.log("form_id"), "the formId is a mock one" === o || getApp().helper.inArray(o, c) || (s.push({
                time: getApp().helper.time(),
                form_id: o
            }), getApp().core.setStorageSync(getApp().const.FORM_ID_LIST, s)), g[n] && "function" == typeof g[n] && g[n](e), 
            a) {
              case "navigate":
                i && getApp().core.navigateTo({
                    url: i
                });
                break;

              case "redirect":
                i && getApp().core.redirectTo({
                    url: i
                });
                break;

              case "switchTab":
                i && getApp().core.switchTab({
                    url: i
                });
                break;

              case "reLaunch":
                i && getApp().core.reLaunch({
                    url: i
                });
                break;

              case "navigateBack":
                i && getApp().core.navigateBack({
                    url: i
                });
                break;

              case "wxapp":
                r && getApp().core.navigateToMiniProgram({
                    url: i,
                    appId: r,
                    path: t.path || ""
                });
            }
        });
    },
    modalClose: function(e) {
        this.currentPage.setData({
            modal_show: !1
        }), console.log("你点击了关闭按钮");
    },
    modalConfirm: function(e) {
        this.currentPage.setData({
            modal_show: !1
        }), console.log("你点击了确定按钮");
    },
    modalShow: function(e) {
        this.currentPage.setData({
            modal_show: !0
        }), console.log("点击会弹出弹框");
    },
    getUserInfo(o) {
      var n     = this;
      "getUserInfo:ok" == o.detail.errMsg && this.login({
        user_info: o.detail.rawData,
        encrypted_data: o.detail.encryptedData,
        iv: o.detail.iv,
        signature: o.detail.signature
      })
    },
    login(o) {
      var app   = getApp();
      var that  = this;
      app.core.SL('登录中...')
      app.WxService.login()
        .then(data => {
          var userInfo  = JSON.parse(o.user_info)
          userInfo.code = data.code
          userInfo.iv   = o.iv
          userInfo.encrypted_data = o.encrypted_data
          userInfo.signature      = o.signature
          wx.setStorageSync('__user_info', userInfo)
          app.HttpService.wechatSignIn({ userInfo: JSON.stringify(userInfo) }).then(res => {
            const { data, state } = res
            if (state == 200) {
              app.WxService.setStorageSync('openid', data.openid)
              app.WxService.setStorageSync('Config', data)
              !this.currentPage.data.userInfo && (this.currentPage.setData({ userInfo: userInfo}))
              that.hideAll()
            }
          })
        })
        // .then(data => {
        //   console.log('登录成功， 登录成功', data)
          // app.WxService.setStorageSync('openid',   data.data.openid)
          // app.WxService.setStorageSync('Config', data.data)
          // // app.WxService.setStorageSync('__user_info', data.data)
          // that.hideAll()
        //   return new Promise((resolve, reject) => {
        //     resolve(data)
        //   })
        // })
    },
    /*完整的登录流程 先判断session 在登录 直到登录成功*/
    wechatSignIn() {
        let that = this
        let app  = getApp()
        return app.WxService.getUserInfo().then(function (o) {
          // 直接
          console.log(o, 'wechatSignIn')
          if (app.WxService.getStorageSync('openid')) {
            // return app.WxService.checkSession().then(function () {
            //   return new Promise((resolve, reject) => {
            //     resolve(wx.getStorageSync('userInfo'))
            //   })
            // }, function () {
            //   console.log('login fail')
            //   that.WxService.removeStorageSync('session')
            //   return that.wechatSignIn()
            // })
            return new Promise((resolve, reject) => {
              resolve(app.WxService.getStorageSync('__user_info'))
            })
          }
          app.core.SL('登录中...')
          return app.WxService.login()
            .then(data => {
              var userInfo            = JSON.parse(o.rawData)
              userInfo.code           = data.code
              userInfo.iv             = o.iv
              userInfo.signature      = o.signature
              userInfo.encrypted_data = o.encrypted_data
              wx.setStorageSync('__user_info', o)
              return app.HttpService.wechatSignIn({
                userInfo: JSON.stringify(userInfo),
              })
            })
            .then(data => {
              app.core.HL()
              console.log('登录成功， 登录成功')
              app.WxService.setStorageSync('openid', data.data.openid)
              app.WxService.setStorageSync('Config', data.data)
              !this.currentPage.data.userInfo && (this.currentPage.setData({ userInfo: data }))
              return new Promise((resolve, reject) => {
                resolve(data)
              })
            })
        }, function (res) {
          // 没有授权信息老哥
          console.log('没有授权信息老哥')
          that.setData({
            user_info_show: !0
          })
          return new Promise((a, b) => {
            b('没有授权信息老哥')
          }) 
        })
    },
    navigateTo(param) {
        let url = param.url
        if (param.param) {
            param.url += '?' + this.toParamStr(param.param)
        }
        console.log(param.url, 'url')
        wx.navigateTo({
            url: param.url,
            fail() {
                wx.switchTab({
                    url,
                    fail() {
                        wx.reLaunch({ url: param.url })
                    }
                })
            }
        })
    },
    unionLogin: function(e) {
        var o = this.currentPage, n = this;
        getApp().core.showLoading({
            title: "正在登录",
            mask: !0
        }), getApp().request({
            url: getApp().api.passport.login,
            method: "POST",
            data: e,
            success: function(e) {
                if (0 == e.code) {
                    o.setData({
                        __user_info: e.data
                    }), getApp().setUser(e.data), getApp().core.setStorageSync(getApp().const.ACCESS_TOKEN, e.data.access_token), 
                    getApp().trigger.run(getApp().trigger.events.login);
                    var t = getApp().core.getStorageSync(getApp().const.STORE);
                    e.data.binding || !t.option.phone_auth || t.option.phone_auth && 0 == t.option.phone_auth ? n.loadRoute() : ("undefined" == typeof wx && n.loadRoute(), 
                    n.setPhone()), n.setUserInfoShowFalse();
                } else getApp().login_complete = !1, getApp().core.showModal({
                    title: "提示",
                    content: e.msg,
                    showCancel: !1
                });
            },
            fail: function() {
                getApp().login_complete = !1;
            },
            complete: function() {
                getApp().core.hideLoading();
            }
        });
    },
    getPhoneNumber: function(o) {
        var n = this.currentPage, a = this;
        "getPhoneNumber:fail user deny" == o.detail.errMsg ? getApp().core.showModal({
            title: "提示",
            showCancel: !1,
            content: "未授权"
        }) : (getApp().core.showLoading({
            title: "授权中"
        }), getApp().core.login({
            success: function(e) {
                if (e.code) {
                    var t = e.code;
                    getApp().request({
                        url: getApp().api.user.user_binding,
                        method: "POST",
                        data: {
                            iv: o.detail.iv,
                            encryptedData: o.detail.encryptedData,
                            code: t
                        },
                        success: function(e) {
                            if (0 == e.code) {
                                var t = n.data.__user_info;
                                t.binding = e.data.dataObj, getApp().setUser(t), n.setData({
                                    PhoneNumber: e.data.dataObj,
                                    __user_info: t,
                                    binding: !0,
                                    binding_num: e.data.dataObj
                                }), a.loadRoute();
                            } else getApp().core.showToast({
                                title: "授权失败,请重试"
                            });
                        },
                        complete: function(e) {
                            getApp().core.hideLoading();
                        }
                    });
                } else getApp().core.showToast({
                    title: "获取用户登录态失败！" + e.errMsg
                });
            }
        }));
    },
    setUserInfoShow: function() {
        var e = this.currentPage;
        "wx" == getApp().platform ? e.setData({
            user_info_show: !0
        }) : this.myLogin();
    },
    setPhone: function() {
        var e = this.currentPage;
        "undefined" == typeof my && e.setData({
            user_bind_show: !0
        });
    },
    setUserInfoShowFalse: function() {
        this.currentPage.setData({
            user_info_show: !1
        });
    },
    closeCouponBox: function(e) {
        this.currentPage.setData({
            get_coupon_list: ""
        });
    },
    relevanceSuccess: function(e) {
        console.log(e);
    },
    relevanceError: function(e) {
        console.log(e);
    },
    setOfficalAccount: function(e) {
        this.currentPage.setData({
            __is_offical_account: !0
        });
    },
    loadRoute: function() {
        var e = this.currentPage;
        "pages/index/index" == e.route || getApp().core.redirectTo({
            url: "/" + e.route + "?" + getApp().helper.objectToUrlParams(e.options)
        }), this.setUserInfoShowFalse();
    },
    setNavi: function() {
        var o = this.currentPage;
        -1 != [ "pages/index/index", "pages/book/details/details", "pages/pt/details/details", "pages/goods/goods" ].indexOf(this.currentPage.route) && o.setData({
            home_icon: !0
        }), getApp().getConfig(function(e) {
            var t = e.store.quick_navigation;
            t.home_img || (t.home_img = "/images/quick-home.png"), o.setData({
                setnavi: t
            });
        });
    },
    saveQrcode: function() {
        var t = this.currentPage;
        getApp().core.saveImageToPhotosAlbum ? (getApp().core.showLoading({
            title: "正在保存图片",
            mask: !1
        }), getApp().core.downloadFile({
            url: t.data.qrcode_pic,
            success: function(e) {
                getApp().core.showLoading({
                    title: "正在保存图片",
                    mask: !1
                }), getApp().core.saveImageToPhotosAlbum({
                    filePath: e.tempFilePath,
                    success: function() {
                        getApp().core.showModal({
                            title: "提示",
                            content: "保存成功",
                            showCancel: !1
                        });
                    },
                    fail: function(e) {
                        getApp().core.showModal({
                            title: "图片保存失败",
                            content: e.errMsg,
                            showCancel: !1
                        });
                    },
                    complete: function(e) {
                        getApp().core.hideLoading();
                    }
                });
            },
            fail: function(e) {
                getApp().core.showModal({
                    title: "图片下载失败",
                    content: e.errMsg + ";" + t.data.goods_qrcode,
                    showCancel: !1
                });
            },
            complete: function(e) {
                getApp().core.hideLoading();
            }
        })) : getApp().core.showModal({
            title: "提示",
            content: "当前版本过低，无法使用该功能，请升级到最新版本后重试。",
            showCancel: !1
        });
    },
    hideAll() {
      var user_info_show  = !1
      getApp().WxService.hideLoading()
      getApp().WxService.hideToast()
      
      /*更新所有页面的 页面授权字段 跟 userInfo*/
      getCurrentPages().forEach((n1, n2) => {
        n1.setData({
          user_info_show: user_info_show,
        })
      })
    },
    prototypePackage() {
      // 日期指定格式输出 yyyy(年)-MM(月)-dd(日) hh(小时):mm(分钟):ss(秒)
      Date.prototype.Format = function (fmt) { // author: meizz
        var o = {
          "M+": this.getMonth() + 1, // 月份
          "d+": this.getDate(), // 日
          "h+": this.getHours(), // 小时
          "m+": this.getMinutes(), // 分
          "s+": this.getSeconds(), // 秒
          "q+": Math.floor((this.getMonth() + 3) / 3), // 季度
          "S": this.getMilliseconds() // 毫秒
        };
        if (/(y+)/.test(fmt))
          fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
          if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
      }
    },
    resetNav(t) {
      function a(e) {
        var a = !1,
          route = t.route || t.__route__ || null,
          o = t.route || t.__route__ || null;
        if (JSON.stringify(t.options) != '{}') {
          o = o + "?";
          var show_nav = false; //当前页面默认不显示导航
          for (var key in t.options) {
            //带有show_nav参数并且等于1的 默认显示导航
            if (key == 'show_nav' && t.options[key] == '1') {
              show_nav = true;
            }
            //首页分销码
            if (t.route == 'pages/index/index' && key == 'scene') {
              show_nav = true;
            }
            o += key + '=' + t.options[key] + '&';
          }
          var reg = /&$/gi;
          o = o.replace(reg, "");
        }

        for (var n in e.navs) {
          //判断当前页面是否显示导航 或者 当前页面是否和导航链接全等
          if (show_nav || e.navs[n].url === "/" + route) {
            //判断是否选择当好图标
            if (e.navs[n].url === "/" + route) {
              e.navs[n].active = !0;
            } else if (show_nav && e.navs[n].url.split('?')[0] == "/" + route) {
              e.navs[n].active = !0;
            }
            a = !0;
          } else {
            e.navs[n].active = !1;
          }
        }
        return (a && !t.setData({
          _navbar: e
        }))
      }
      var o       = getApp().globalData._navbar
      return (t && !t.setData({_navbar: false}) && o && a(o));
    },
    showAuth() {
      this.currentPage.setData({
        user_info_show: true
      })
    },
    hideAuth() {
      this.currentPage.setData({
        user_info_show: false
      })
    }
};